import os,common._conts

def d_file():
    # 删除文件
    if (os.path.exists(common._conts.LOCAL_TMP_TXT)):
        os.remove(common._conts.LOCAL_TMP_TXT)


    # 写入文件
    writeFile = open(common._conts.LOCAL_TMP_TXT, mode='x', encoding=common._conts.CHARSET)  # 已存在用w  否则x
    data = ["java", "C++", "python", "剛個給"]
    for d in data:
        writeFile.write(d)
        writeFile.write("\n")
    writeFile.close()


    # 读取文件
    readFile = open(common._conts.LOCAL_TMP_TXT,mode='r',encoding=common._conts.CHARSET)
    data = readFile.readlines()
    for x in data:
        print(x,end="")
    readFile.close()
